home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
AIncludes
/
TextUtils.a
< prev
next >
Wrap
Text File
|
1996-05-01
|
10KB
|
416 lines
;
; File: TextUtils.a
;
; Contains: Text Utilities Interfaces.
;
; Version: Technology: System 7.0 through System 8
; Release: Universal Interfaces 3.0d3 on Copland DR1
;
; Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
;
; Bugs?: If you find a problem with this file, send the file and version
; information (from above) and the problem description to:
;
; Internet: apple.bugs@applelink.apple.com
; AppleLink: APPLE.BUGS
;
;
IF &TYPE('__TEXTUTILS__') = 'UNDEFINED' THEN
__TEXTUTILS__ SET 1
IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
include 'Types.a'
ENDIF
IF &TYPE('__SCRIPT__') = 'UNDEFINED' THEN
include 'Script.a'
ENDIF
IF &TYPE('__OSUTILS__') = 'UNDEFINED' THEN
include 'OSUtils.a'
ENDIF
IF &TYPE('__TEXTOBJECTS__') = 'UNDEFINED' THEN
include 'TextObjects.a'
ENDIF
IF &TYPE('__NUMBERFORMATTING__') = 'UNDEFINED' THEN
include 'NumberFormatting.a'
ENDIF
IF &TYPE('__TIMEOBJECTS__') = 'UNDEFINED' THEN
include 'TimeObjects.a'
ENDIF
IF &TYPE('__STRINGCOMPARE__') = 'UNDEFINED' THEN
include 'StringCompare.a'
ENDIF
;
;
; Here are the current System 7 routine names and the translations to the older forms.
; Please use the newer forms in all new code and migrate the older names out of existing
; code as maintainance permits.
;
; NEW NAME OLD NAMEs OBSOLETE FORM (no script code)
;
; FindScriptRun
; FindWordBreaks NFindWord, FindWord
; GetIndString
; GetString
; Munger
; NewString
; SetString
; StyledLineBreak
; TruncString
; TruncText
;
; UpperString ($A054) UprString, UprText
; UppercaseText SCUpperText (a only) UpperText ($A456)
; LowercaseText LwrString, LowerText, LwrText ($A056)
; StripDiacritics StripText ($A256)
; UppercaseStripDiacritics StripUpperText ($A656)
;
;
;
IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
; Type for truncWhere parameter in TruncString, TruncText
; typedef short TruncCode
; Constants for truncWhere argument in TruncString and TruncText
truncEnd EQU 0 ; Truncate at end
truncMiddle EQU $4000 ; Truncate in middle
smTruncEnd EQU 0 ; Truncate at end - obsolete
smTruncMiddle EQU $4000 ; Truncate in middle - obsolete
; Constants for TruncString and TruncText results
notTruncated EQU 0 ; No truncation was necessary
truncated EQU 1 ; Truncation performed
truncErr EQU -1 ; General error
smNotTruncated EQU 0 ; No truncation was necessary - obsolete
smTruncated EQU 1 ; Truncation performed - obsolete
smTruncErr EQU -1 ; General error - obsolete
; typedef SInt8 StyledLineBreakCode
smBreakWord EQU 0
smBreakChar EQU 1
smBreakOverflow EQU 2
ScriptRunStatus RECORD 0
script ds.b 1 ; offset: $0 (0)
runVariant ds.b 1 ; offset: $1 (1)
sizeof EQU * ; size: $2 (2)
ENDR
BreakTable RECORD 0
charTypes ds.b 256 ; offset: $0 (0)
tripleLength ds.w 1 ; offset: $100 (256)
triples ds.w 1 ; offset: $102 (258) <-- really an array of length one
sizeof EQU * ; size: $104 (260)
ENDR
; typedef struct BreakTable * BreakTablePtr
NBreakTable RECORD 0
flags1 ds.b 1 ; offset: $0 (0)
flags2 ds.b 1 ; offset: $1 (1)
version ds.w 1 ; offset: $2 (2)
classTableOff ds.w 1 ; offset: $4 (4)
auxCTableOff ds.w 1 ; offset: $6 (6)
backwdTableOff ds.w 1 ; offset: $8 (8)
forwdTableOff ds.w 1 ; offset: $A (10)
doBackup ds.w 1 ; offset: $C (12)
length ds.w 1 ; offset: $E (14) ; length of NBreakTable
charTypes ds.b 256 ; offset: $10 (16)
tables ds.w 1 ; offset: $110 (272) <-- really an array of length one
sizeof EQU * ; size: $112 (274)
ENDR
; typedef struct NBreakTable * NBreakTablePtr
; The following functions are new names that work on 68k and PowerPC
;
; pascal long Munger(Handle h, long offset, const void *ptr1, long len1, const void *ptr2, long len2)
;
IF ¨ GENERATINGCFM THEN
_Munger: OPWORD $A9E0
ELSE
IMPORT_CFM_FUNCTION Munger
ENDIF
;
; pascal StringHandle NewString(ConstStr255Param theString)
;
IF ¨ GENERATINGCFM THEN
_NewString: OPWORD $A906
ELSE
IMPORT_CFM_FUNCTION NewString
ENDIF
;
; pascal void SetString(StringHandle theString, ConstStr255Param strNew)
;
IF ¨ GENERATINGCFM THEN
_SetString: OPWORD $A907
ELSE
IMPORT_CFM_FUNCTION SetString
ENDIF
;
; pascal StringHandle GetString(short stringID)
;
IF ¨ GENERATINGCFM THEN
_GetString: OPWORD $A9BA
ELSE
IMPORT_CFM_FUNCTION GetString
ENDIF
;
; pascal StyledLineBreakCode StyledLineBreak(Ptr textPtr, long textLen, long textStart, long textEnd, long flags, Fixed *textWidth, long *textOffset)
;
IF ¨ GENERATINGCFM THEN
Macro
_StyledLineBreak
move.l #$821CFFFE,-(sp)
dc.w $A8B5
EndM
ELSE
IMPORT_CFM_FUNCTION StyledLineBreak
ENDIF
;
; pascal short TruncString(short width, Str255 theString, TruncCode truncWhere)
;
IF ¨ GENERATINGCFM THEN
Macro
_TruncString
move.l #$8208FFE0,-(sp)
dc.w $A8B5
EndM
ELSE
IMPORT_CFM_FUNCTION TruncString
ENDIF
;
; pascal short TruncText(short width, Ptr textPtr, short *length, TruncCode truncWhere)
;
IF ¨ GENERATINGCFM THEN
Macro
_TruncText
move.l #$820CFFDE,-(sp)
dc.w $A8B5
EndM
ELSE
IMPORT_CFM_FUNCTION TruncText
ENDIF
;
; pascal void FindWordBreaks(Ptr textPtr, short textLength, short offset, Boolean leadingEdge, BreakTablePtr breaks, OffsetTable offsets, ScriptCode script)
;
IF ¨ GENERATINGCFM THEN
Macro
_FindWordBreaks
move.l #$C012001A,-(sp)
dc.w $A8B5
EndM
ELSE
IMPORT_CFM_FUNCTION FindWordBreaks
ENDIF
;
; pascal void LowercaseText(Ptr textPtr, short len, ScriptCode script)
;
IF ¨ GENERATINGCFM THEN
Macro
_LowercaseText
move.w #$0000,-(sp)
move.l #$800AFFB6,-(sp)
dc.w $A8B5
EndM
ELSE
IMPORT_CFM_FUNCTION LowercaseText
ENDIF
;
; pascal void UppercaseText(Ptr textPtr, short len, ScriptCode script)
;
IF ¨ GENERATINGCFM THEN
Macro
_UppercaseText
move.w #$0400,-(sp)
move.l #$800AFFB6,-(sp)
dc.w $A8B5
EndM
ELSE
IMPORT_CFM_FUNCTION UppercaseText
ENDIF
;
; pascal void StripDiacritics(Ptr textPtr, short len, ScriptCode script)
;
IF ¨ GENERATINGCFM THEN
Macro
_StripDiacritics
move.w #$0200,-(sp)
move.l #$800AFFB6,-(sp)
dc.w $A8B5
EndM
ELSE
IMPORT_CFM_FUNCTION StripDiacritics
ENDIF
;
; pascal void UppercaseStripDiacritics(Ptr textPtr, short len, ScriptCode script)
;
IF ¨ GENERATINGCFM THEN
Macro
_UppercaseStripDiacritics
move.w #$0600,-(sp)
move.l #$800AFFB6,-(sp)
dc.w $A8B5
EndM
ELSE
IMPORT_CFM_FUNCTION UppercaseStripDiacritics
ENDIF
;
; pascal ScriptRunStatus FindScriptRun(Ptr textPtr, long textLen, long *lenUsed)
;
IF ¨ GENERATINGCFM THEN
Macro
_FindScriptRun
move.l #$820C0026,-(sp)
dc.w $A8B5
EndM
ELSE
IMPORT_CFM_FUNCTION FindScriptRun
ENDIF
ENDIF
; FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
IF FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE THEN
;
; pascal void UpperString(Str255 theString, Boolean diacSensitive)
;
IF ¨ GENERATINGCFM THEN
_UpperString: OPWORD $A054
ELSE
IMPORT_CFM_FUNCTION UpperString
ENDIF
;
; pascal void UpperStringMarks(Str255 theString)
;
IF ¨ GENERATINGCFM THEN
_UpperStringMarks: OPWORD $A254
ELSE
IMPORT_CFM_FUNCTION UpperStringMarks
ENDIF
; Old routine name but no new names are mapped to it:
;
; pascal void UprText(Ptr textPtr, short len)
;
IF ¨ GENERATINGCFM THEN
; parameters:
; textPtr => A0
; len => D0
_UprText: OPWORD $A054
ELSE
IMPORT_CFM_FUNCTION UprText
ENDIF
ENDIF
; FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE
;
; The following functions are old names, but are required for PowerPC builds
; because InterfaceLib exports these names, instead of the new ones.
;
IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
;
; pascal void FindWord(Ptr textPtr, short textLength, short offset, Boolean leadingEdge, BreakTablePtr breaks, OffsetTable offsets)
;
IF ¨ GENERATINGCFM THEN
Macro
_FindWord
move.l #$8012001A,-(sp)
dc.w $A8B5
EndM
ELSE
IMPORT_CFM_FUNCTION FindWord
ENDIF
;
; pascal void NFindWord(Ptr textPtr, short textLength, short offset, Boolean leadingEdge, NBreakTablePtr nbreaks, OffsetTable offsets)
;
IF ¨ GENERATINGCFM THEN
Macro
_NFindWord
move.l #$8012FFE2,-(sp)
dc.w $A8B5
EndM
ELSE
IMPORT_CFM_FUNCTION NFindWord
ENDIF
;
; pascal void LwrText(Ptr textPtr, short len)
;
IF ¨ GENERATINGCFM THEN
; parameters:
; textPtr => A0
; len => D0
_LwrText: OPWORD $A056
ELSE
IMPORT_CFM_FUNCTION LwrText
ENDIF
;
; pascal void LowerText(Ptr textPtr, short len)
;
IF ¨ GENERATINGCFM THEN
; parameters:
; textPtr => A0
; len => D0
_LowerText: OPWORD $A056
ELSE
IMPORT_CFM_FUNCTION LowerText
ENDIF
;
; pascal void StripText(Ptr textPtr, short len)
;
IF ¨ GENERATINGCFM THEN
; parameters:
; textPtr => A0
; len => D0
_StripText: OPWORD $A256
ELSE
IMPORT_CFM_FUNCTION StripText
ENDIF
;
; pascal void UpperText(Ptr textPtr, short len)
;
IF ¨ GENERATINGCFM THEN
; parameters:
; textPtr => A0
; len => D0
_UpperText: OPWORD $A456
ELSE
IMPORT_CFM_FUNCTION UpperText
ENDIF
;
; pascal void StripUpperText(Ptr textPtr, short len)
;
IF ¨ GENERATINGCFM THEN
; parameters:
; textPtr => A0
; len => D0
_StripUpperText: OPWORD $A656
ELSE
IMPORT_CFM_FUNCTION StripUpperText
ENDIF
ENDIF
; FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
IF ¨ OLDROUTINELOCATIONS THEN
IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
ENDIF
; FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
ENDIF
; !OLDROUTINELOCATIONS
ENDIF ; __TEXTUTILS__